/**
 * 
 */
package com.disys.mb;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.apache.log4j.Logger;

import com.disys.common.IRecordType;
import com.disys.facade.Rec210emplpayinfoFacade;
import com.disys.model.Rec210emplpayinfo;

/**
 * @author Ubaid Raja
 * 
 */
@RequestScoped
@ManagedBean(name = "rec210MB")
public class Rec210MB extends AbstractMB implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7932940729870613187L;
	private static final transient Logger logger = Logger
			.getLogger(Rec210MB.class.getName());

	private Rec210emplpayinfo record;

	private List<Rec210emplpayinfo> records;

	private Rec210emplpayinfoFacade recFacade;

	private Map<Integer,Integer> processList;
	private Integer selectedProcessId;
	
	/**
	 * @return the record
	 */
	public Rec210emplpayinfo getRecord() {
		return record;
	}

	/**
	 * @param record the record to set
	 */
	public void setRecord(Rec210emplpayinfo record) {
		this.record = record;
	}

	/**
	 * @return the records
	 */
	public List<Rec210emplpayinfo> getRecords() {
		if(records == null){
			records = new ArrayList<Rec210emplpayinfo>();
			records = getRecFacade().findAllRecords();
		}
		return records;
	}

	/**
	 * @param records the records to set
	 */
	public void setRecords(List<Rec210emplpayinfo> records) {
		this.records = records;
	}

	/**
	 * @return the recFacade
	 */
	public Rec210emplpayinfoFacade getRecFacade() {
		if(recFacade == null){
			recFacade = new Rec210emplpayinfoFacade();
		}
		return recFacade;
	}

	/**
	 * @param recFacade the recFacade to set
	 */
	public void setRecFacade(Rec210emplpayinfoFacade recFacade) {
		this.recFacade = recFacade;
	}

	/**
	 * @return the processList
	 */
	public Map<Integer, Integer> getProcessList() {
		if(processList == null){
			processList = new LinkedHashMap<Integer, Integer>();
			List<Integer> list = getRecFacade().getAllProcessIds(IRecordType.PROCESS);
			for(int i=0; i<list.size();i++){
				processList.put(list.get(i), list.get(i));
			}
		}
		return processList;
	}

	/**
	 * @param processList the processList to set
	 */
	public void setProcessList(Map<Integer, Integer> processList) {
		this.processList = processList;
	}

	/**
	 * @return the selectedProcessId
	 */
	public Integer getSelectedProcessId() {
		return selectedProcessId;
	}

	/**
	 * @param selectedProcessId the selectedProcessId to set
	 */
	public void setSelectedProcessId(Integer selectedProcessId) {
		this.selectedProcessId = selectedProcessId;
	}

}
